﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace SF.BLL
{ 
    public class statistics
    {

        private readonly DAL.statistics dal = new DAL.statistics();
        /// <summary>
        /// 获取服务号总营业额
        /// </summary>
        /// <param name="businessNum"></param>
        /// <returns></returns>
        public decimal GetAppNumTotalMoney(string appNum)
        {
            return dal.GetAppNumTotalMoney(appNum);
        }

        /// <summary>
        /// 获取服务号订单总数
        /// </summary>
        /// <param name="appNum"></param>
        /// <returns></returns>
        public int GetAppNumOrdersCount(string appNum)
        {
            return dal.GetAppNumOrdersCount(appNum);
        }

        /// <summary>
        /// 获取服务号客户总数
        /// </summary>
        /// <param name="appNum"></param>
        /// <returns></returns>
        public int GetAppNumCustomersCount(string appNum)
        {
            return dal.GetAppNumCustomersCount(appNum);
        }

        /// <summary>
        /// 获取指定商户服务号个数
        /// </summary>
        /// <param name="businessNum"></param>
        /// <returns></returns>
        public int GetBusinessAppIdCount(string businessNum)
        {
            return dal.GetBusinessAppIdCount(businessNum);
        }

        /// <summary>
        /// 获取服务号当天消息总数
        /// </summary>
        /// <param name="accept_user_name"></param>
        /// <returns></returns>
        public int GetAppNumTodayNoticesCount(string accept_user_name)
        {
            return dal.GetAppNumTodayNoticesCount(accept_user_name);
        }

        /// <summary>
        /// 获取服务号当天订单总数
        /// </summary>
        /// <param name="appNum"></param>
        /// <returns></returns>
        public int GetAppNumTodayOrdersCount(string appNum)
        {
            return dal.GetAppNumTodayOrdersCount(appNum);
        }
        /// <summary>
        /// 获取服务号当天客户总数
        /// </summary>
        /// <param name="appNum"></param>
        /// <returns></returns>
        public int GetAppNumTodayCustomersCount(string appNum)
        {
            return dal.GetAppNumTodayCustomersCount(appNum);
        }

        #region 以下方法用于admin/statistics中的页面

        /// <summary>
        /// 获取商户一段时间内的订单统计信息（公众服务好,订购时间，数量，总金额）
        /// </summary>
        /// <returns></returns>
        public System.Data.DataSet GetOrderTimesDataByBusinessNum(string businessNum , string startTime ,string endTime) 
        {
            return dal.GetOrderTimesDataByBusinessNum(businessNum,startTime,endTime);
        }


        /// <summary>
        /// 获取指定公众服务号下的客户来源
        /// </summary>
        /// <param name="appNum"></param>
        /// <returns></returns>
        public System.Data.DataSet GetCustomerSourceByAppNum(string appNum)
        {
            return dal.GetCustomerSourceByAppNum(appNum);
        }
        /// <summary>
        /// 获取指定公众服务号下的客户来源
        /// 官方使用
        /// </summary>
        /// <returns></returns>
        public System.Data.DataSet GetCustomerSourceByAppNum()
        {
            return dal.GetCustomerSourceByAppNum();
        }

        /// <summary>
        /// 获取指定商户客户来源数据(group by appNum)
        /// </summary>
        /// <param name="businessNum"></param>
        /// <returns></returns>
        public System.Data.DataSet GetCustomerSourceByBusinessNum(string businessNum) 
        {
            return dal.GetCustomerSourceByBusinessNum(businessNum);
        }


        /// <summary>
        /// 获取指定公众号订单报表统计数据
        /// </summary>
        /// <param name="appNum"></param>
        /// <returns></returns>
        public System.Data.DataSet GetOrderReportByAppNum(string appNum)
        {
            return dal.GetOrderReportByAppNum(appNum);
        }
        /// <summary>
        /// 获取所有订单报表统计数据
        /// 官方管理使用
        /// </summary>
        /// <param name="appNum"></param>
        /// <returns></returns>
        public System.Data.DataSet GetOrderReportByAppNum()
        {
            return dal.GetOrderReportByAppNum();
        }

        /// <summary>
        /// 获取指定商户订单报表统计数据
        /// </summary>
        /// <param name="appNum"></param>
        /// <returns></returns>
        public System.Data.DataSet GetOrderReportByBusinessNum(string businessNum) 
        {
            return dal.GetOrderReportByBusinessNum(businessNum);
        }

        /// <summary>
        /// 通过公众服务号获取一段时间内的客户数据
        /// </summary>
        /// <param name="businessNum"></param>
        /// <param name="strStartTime"></param>
        /// <param name="strEndTime"></param>
        /// <returns></returns>
        public System.Data.DataSet GetCustomerTimesDataByAppNum(string appNum, string strStartTime, string strEndTime)
        {
            return dal.GetCustomerTimesDataByAppNum(appNum, strStartTime, strEndTime);
        }
        /// <summary>
        /// 通过公众服务号获取一段时间内的客户数据
        /// 官方使用
        /// </summary>
        /// <param name="strStartTime"></param>
        /// <param name="strEndTime"></param>
        /// <returns></returns>
        public System.Data.DataSet GetCustomerTimesDataByAppNum(string strStartTime, string strEndTime)
        {
            return dal.GetCustomerTimesDataByAppNum(strStartTime, strEndTime);
        }

        /// <summary>
        /// 通过商户号获取一段时间内的客户数据
        /// </summary>
        /// <param name="businessNum"></param>
        /// <param name="selTimes"></param>
        /// <param name="strStartTime"></param>
        /// <param name="strEndTime"></param>
        /// <returns></returns>
        public System.Data.DataSet GetCustomerTimesDataByBusinessNum(string businessNum, string strStartTime, string strEndTime) 
        {
            return dal.GetCustomerTimesDataByBusinessNum(businessNum, strStartTime, strEndTime);
        }

        /// <summary>
        /// 通过公众号获取一段时间内订单走势（年度-月份）
        /// </summary>
        /// <param name="businessNum"></param>
        /// <param name="strStartTime"></param>
        /// <param name="strEndTime"></param>
        /// <returns></returns>
        public System.Data.DataSet GetOrderTrendTimesDataByAppNum(string appNum, string strStartTime, string strEndTime)
        {
            return dal.GetOrderTrendTimesDataByAppNum(appNum, strStartTime, strEndTime);
        }
        /// <summary>
        /// 通过公众号获取一段时间内订单走势（年度-月份）
        /// 官方管理使用
        /// </summary>
        /// <param name="strStartTime"></param>
        /// <param name="strEndTime"></param>
        /// <returns></returns>
        public System.Data.DataSet GetOrderTrendTimesDataByAppNum(string strStartTime, string strEndTime)
        {
            return dal.GetOrderTrendTimesDataByAppNum(strStartTime, strEndTime);
        }

        /// <summary>
        /// 通过商户编号获取一段时间内订单走势（年度-月份）
        /// </summary>
        /// <param name="businessNum"></param>
        /// <param name="strStartTime"></param>
        /// <param name="strEndTime"></param>
        /// <returns></returns>
        public System.Data.DataSet GetOrderTrendTimesDataByBusinessNum(string businessNum, string strStartTime, string strEndTime)
        {
            return dal.GetOrderTrendTimesDataByBusinessNum(businessNum, strStartTime, strEndTime);
        }

        /// <summary>
        /// 获取客户来源转换率
        /// </summary>
        /// <param name="businessNum"></param>
        /// <returns></returns>
        public System.Data.DataSet GetCustomerSourceRatesByBusinessNum(string businessNum)
        {
            return dal.GetCustomerSourceRatesByBusinessNum(businessNum);
        }

        /// <summary>
        /// 获取指定公众号的环比数据
        /// </summary>
        /// <param name="appNum"></param>
        /// <param name="strStartTime"></param>
        /// <param name="strEndTime"></param>
        /// <returns></returns>
        public System.Data.DataSet GetQuarterDataByAppNum(string appNum, string strStartTime, string strEndTime)
        {
            return dal.GetQuarterDataByAppNum(appNum, strStartTime, strEndTime);
        }
        /// <summary>
        /// 获取指定公众号的环比数据
        /// 官方使用
        /// </summary>
        /// <param name="strStartTime"></param>
        /// <param name="strEndTime"></param>
        /// <returns></returns>
        public System.Data.DataSet GetQuarterDataByAppNum(string strStartTime, string strEndTime)
        {
            return dal.GetQuarterDataByAppNum(strStartTime, strEndTime);
        }


        /// <summary>
        /// 获取指定商户的环比数据
        /// </summary>
        /// <param name="appNum"></param>
        /// <param name="strStartTime"></param>
        /// <param name="strEndTime"></param>
        /// <returns></returns>
        public System.Data.DataSet GetQuarterDataByBusinessNum(string businessNum, string strStartTime, string strEndTime)
        {
            return dal.GetQuarterDataByBusinessNum(businessNum, strStartTime, strEndTime);
        }

        #endregion

    }
}
